;(function(angular) {
  angular.module('myController', [])
         .controller('myCtrl', ['$scope', function($scope) {
            $scope.show = true;
            $scope.allData = false
            $scope.list = [
              {checked: false},
              {checked: false},
              {checked: false},
            ];
            // 点击按钮
            $scope.getShow = function() {
              $scope.show = !$scope.show;
            }
            // 全选方法
            $scope.all = function(data) {
              console.log(data);
              if (data) {
                for (var i =0; i< $scope.list.length; i++) {
                  var cur = $scope.list[i];
                  cur.checked = true
                }
              } else {
                for (var i =0; i< $scope.list.length; i++) {
                  var cur = $scope.list[i];
                  cur.checked = false
                }
              }
            }
            // 多选方法
            $scope.ck = function(item) {
              let count = 0;
              for (var i =0; i< $scope.list.length; i++) {
                var cur = $scope.list[i];
                if (cur.checked) {
                  count++;
                }
              }
              if (count === $scope.list.length) {
                $scope.allData = true
              } else {
                $scope.allData = false
              }

            }
         }])
})(angular)
